#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <fcntl.h>
#include <sys/stat.h>
#include <sys/types.h>
#include <mqueue.h>
struct mq_attr attr;
int
main(int argc, char *argv[])
{
	int c,flags;
	mqd_t mqd;
	flags = O_RDWR|O_CREAT;
	attr.mq_maxmsg = 1024;
	attr.mq_msgsize = 20;

	if((attr.mq_maxmsg != 0 && attr.mq_msgsize == 0)
	|| (attr.mq_maxmsg == 0 && attr.mq_msgsize !=0))
	{
		printf("must specify both -m maxmsg and -z msgsize!\n");
	}
	mqd = mq_open("/-xx", flags, 0644, (attr.mq_maxmsg != 0) ? &attr : NULL);
	if(mqd != -1)
	{
		printf("create ok!\n");
		mq_close(mqd);
	}
	else
	{
		printf("create error!\n");
	}
	return 0;
}
